<?php
namespace Tlf\Scrawl\FileExt;
/**
* Export code between `// @export_start(key)` and `// @export_end(key)`
*
*/
class ExportStartEnd {
use \BetterRegTrait;
use \BetterRegShorthandsTrait;
protected $regData = [
'WrappedGenericBlock' =>
//For this regex: $1 is the key, $2 is the code, $3 is the @export_end line
'/\ *(?:\/\/|\#)\ *@export_start\(([^\)]*)\)((?:.|\r|\n)+)\ *(?:\/\/|\#)\ *(@export_end\(\1\))/',
];
public function __construct(){}
public function get_exports($str){
$list = explode('@export_start(', $str);
$ret = $this->match('WrappedGenericBlock',$str);
var_dump($ret);
exit;
}
public function matchWrappedGenericBlock($info, $key, $code, $exportLine){
echo "\n\n\n-----------\n\n";
print_r($info);
echo "\n\n\n-----------\n\n";
exit;
print_r($code);
$code = \Tlf\Scrawl\Utility\Main::trimTextBlock($code);
return $code;
$this->scrawl->addOutput('key', $key, $code);
}
//@export_start(Regex.invoke)
public function onSourceFileFound($file){
$this->match('WrappedGenericBlock',$file->content());
}
//@export_end(Regex.invoke)
}